# Create your views here.
from django.http import HttpResponse

from django.template import Context, loader
from SpotBug.SpotBugApp.models import WordAbbr
from django.http import Http404
from django.shortcuts import render_to_response



def index(request):
    wordlist =  WordAbbr.objects.all()
    t = loader.get_template('SpotBugApp/index.html')
    c = Context({'wordlist': wordlist})
    return HttpResponse(t.render(c))


def detail(request, wid):
    try:
        p = WordAbbr.objects.get(pk=wid)
    except WordAbbr.DoesNotExist:
        raise Http404
    return render_to_response('SpotBugApp/detail.html', {'word': p})




